<template>
	<view class="page">
		<!-- <view class="flex benben-position-layout flex flex-wrap align-center testExamination_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-center justify-between flex-sub testExamination_fd0_0'>
				<view class='flex flex-wrap align-center' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
					<text class='fu-iconfont2  testExamination_fd0_0_c0_c0'>&#xE794;</text>
				</view>
				<text class='testExamination_fd0_0_c1'>紧急联系人</text>
				<view class='flex flex-wrap align-center testExamination_fd0_0_c2'>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view> -->
		<view class="loading_css" v-if="isShow">
			<u-loading size="36" color="#FC5B03"></u-loading>
			<view>加载中</view>
		</view>
		<template v-else>
			<view class="content_title">添加紧急联系人</view>
			<view class="content_view" style="padding-bottom: 0;">
				
				<view class='flex flex-wrap align-center justify-between personalInformation_fd1_0'>
					<text class='personalInformation_fd1_0_c0'>姓名</text>
					<input class='flex-sub personalInformation_fd1_1_c1' type="text" placeholder="请输入姓名" confirm-type="done"
						:maxlength="14" placeholder-style="color:rgba(102, 102, 102, 1);font-size:28rpx"
						v-model="user.jjlxr_name" />
				</view>
				<view class='flex flex-wrap align-center justify-between personalInformation_fd1_0'>
					<text class='personalInformation_fd1_0_c0'>手机号</text>
					<input class='flex-sub personalInformation_fd1_1_c1' type="number" placeholder="请输入手机号" confirm-type="done"
						:maxlength="11" placeholder-style="color:rgba(102, 102, 102, 1);font-size:28rpx"
						v-model="user.jjlxr_phone" />
				</view>
			</view>
			
			<view class="flex align-center justify-between feedback_flex_4" @tap.stop="saveContact">
				<view class='feedback_fd4_0'>保存</view>
			
			</view>
		</template>
		
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},

		data() {
			return {
				"id": "",
				"name": "",
				"user": {
					jjlxr_name: "",
					jjlxr_phone: "",
				},
				"isShow": true,
				"is_submit": false,
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {
			this.getgetUser();
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//获取个人信息
			async getgetUser() {
				//请求方法
				//数据验证
			
				let userData = await this.$api.get(global.apiUrls.getUser_info, {
					
				});
				this.isShow = false;
				if (userData.data.code != 1) {
					this.$message.info(userData.data.info);
					return
				}
				let userinfo = userData.data;
				this.user = userinfo.data;
			},
			// 保存联系人
			saveContact() {
				if (this.is_submit) return;
				if (!this.user.jjlxr_name) {
					this.$message.info('请输入姓名');
					return false;
				}
				if (!validate(this.user.jjlxr_phone, 'require')) {
					this.$message.info('请输入手机号');
					return false;
				}
				if (!validate(this.user.jjlxr_phone, 'phone')) {
					this.$message.info('请输入正确的手机号');
					return false;
				}
				this.is_submit = true;
				this.$api.post(global.apiUrls.postSaveInformation, {
					jjlxr_name: this.user.jjlxr_name,
					jjlxr_phone: this.user.jjlxr_phone
				}).then(res => {
					this.$message.info(res.data.info);
					if (res.data.code == 1) {
						setTimeout(() => {
							this.is_submit = false;
							uni.$emit('save');
							uni.navigateBack();
						}, 800)
					} else {
						this.is_submit = false;
					}
				}).catch(err => {
					this.is_submit = false;
				})
			}
		}
	};
</script>
<style lang="scss" scoped>
	.sex_content {
		display: flex;
		align-items: center;
		.sex_item {
			display: flex;
			align-items: center;
			margin-left: 30rpx;
			image {
				width: 32rpx;
				height: 32rpx;
				margin-right: 10rpx;
			}
			text {
				font-weight: 500;
				font-size: 28rpx;
				color: rgba(0,0,0,0.8);
			}
		}
	}
	.content_view {
		background: #fff;
		border-radius: 16rpx;
		padding: 0rpx 24rpx;
		margin: 32rpx;
		.cards {
			display: flex;
			align-items: center;
			justify-content: space-between;
			.cards_item {
				.cards_item_img {
					width: 320rpx;
					height: 168rpx;
					position: relative;
					image {
						width: 100%;
						height: 100%;
						border-radius: 8rpx;
					}
					.add_icon {
						width: 74rpx;
						height: 74rpx;
						position: absolute;
						top: 50%;
						left: 50%;
						transform: translate(-50%, -50%);
					}
				}
				.cards_item_tip {
					text-align: center;
					font-weight: 400;
					font-size: 24rpx;
					color: #222222;
					margin-top: 20rpx;
				}
			}
		}
	}
	.content_title {
		font-weight: bold;
		font-size: 36rpx;
		color: #111111;
		margin:44rpx 0 32rpx;
		padding: 0 32rpx;
	}
	
	.personalInformation_fd1_0 {
		padding: 24rpx 0;
	}
	
	.personalInformation_fd1_0_c0 {
		font-size: 28rpx;
		color: rgba(0,0,0,0.6);
	}
	.personalInformation_fd1_1_c1 {
		font-size: 28rpx;
		font-weight: 400;
		color: #111;
		text-align: right;
	}
	
	
	.feedback_fd4_0 {
		width: 640rpx;
		border-radius: 80rpx;
		font-size: 30rpx;
		font-weight: bold;
		color: #fff;
		margin: 0rpx 32rpx 0rpx 32rpx;
		height: 84rpx;
		line-height: 84rpx;
		text-align: center;
		background: #FC5B03;
	}
	
	.feedback_flex_4 {
		width: 750rpx;
		height: 120rpx;
		overflow: hidden;
		position: fixed;
		z-index: 10;
		bottom: calc(0rpx + var(--window-bottom));
		display: flex;
		justify-content: center;
		background: #fff;
	}
	
	
	
	
	.testExamination_fd1_0 {
		margin: 0rpx 16rpx 0rpx 0rpx;
		padding: 40rpx 32rpx 24rpx 32rpx;
	}

	.testExamination_fd1_0_c0 {
		width: 36rpx;
		height: 36rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.testExamination_fd1_0_c1 {
		line-height: 45rpx;
		font-size: 32rpx;
		font-weight: 700;
		color: #333333;
	}

	.testExamination_notAnfd1_1_c0 {
		background: rgba(244, 250, 255, 1);
		background-size: 100% !important;
		width: 750rpx;
		height: 80rpx;
		border-radius: 40rpx 40rpx 40rpx 40rpx;
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.testExamination_anfd1_1_c0 {
		background: rgba(244, 250, 255, 1);
		background-size: 100% !important;
		border-radius: 40rpx 40rpx 40rpx 40rpx;
		padding: 0rpx 32rpx 0rpx 32rpx;
		width: 750rpx;
		height: 80rpx;
	}

	.testExamination_areafd1_1_c0 {
		min-height: 80rpx;
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.testExamination_notAnfd1_1_c0_c0_c0 {
		width: 36rpx;
		height: 36rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.testExamination_notAnfd1_1_c0_c0_c1 {
		margin: 0rpx 20rpx 0rpx 0rpx;
		line-height: 45rpx;
		font-size: 32rpx;
		font-weight: 700;
		color: #1593FF;
	}

	.testExamination_notAnfd1_1_c0_c0_c2 {
		font-weight: 700;
		font-size: 32rpx;
		color: #1593FF;
		line-height: 45rpx;
		text-decoration: none;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
	}

	.testExamination_anfd1_1_c0_c0_c0 {
		width: 36rpx;
		height: 36rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.testExamination_anfd1_1_c0_c0_c1 {
		margin: 0rpx 20rpx 0rpx 0rpx;
		line-height: 45rpx;
		font-size: 32rpx;
		font-weight: 700;
		color: #1593FF;
	}

	.testExamination_anfd1_1_c0_c0_c2 {
		font-weight: 700;
		font-size: 32rpx;
		color: #1593FF;
		line-height: 45rpx;
		text-decoration: none;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
	}

	.testExamination_areafd1_1_c0_c0 {
		border-bottom: 1px solid #eee;
		padding: 32rpx 0rpx 40rpx 0rpx;
	}

	.testExamination_areafd1_1_c0_c0_c0 {
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.testExamination_areafd1_1_c0_c0_c0_c0_c0 {
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.testExamination_areafd1_1_c0_c0_c0_c0_c0_c0 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
		margin: 0rpx 15rpx 0rpx 0rpx;
	}

	.testExamination_areafd1_1_c0_c0_c0_c0_c0_c1 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
	}

	.testExamination_areafd1_1_c0_c0_c0_c0_c1_c0 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(21, 147, 255, 1);
	}

	.testExamination_areafd1_1_c0_c0_c0_c0_c1_c1 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
	}

	.testExamination_areafd1_1_c0_c0_c0_c0_c1_c2 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
	}

	.testExamination_areafd1_1_c0_c0_c0_c0_c1_c3 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
		margin: 0rpx 32rpx 0rpx 0rpx;
	}

	.testExamination_areafd1_1_c0_c0_c0_c0_c1_c4 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
	}

	.testExamination_areafd1_1_c0_c0_c0_c0_c1_c5 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
	}

	.testExamination_areafd1_1_c0_c0_c0_c1 {
		font-size: 26rpx;
		color: rgba(191, 191, 191, 1);
	}

	.testExamination_areafd1_1_c0_c0_c1 {
		background: rgba(242, 242, 242, 1);
		background-size: 100% !important;
		width: 602rpx;
		height: 16rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		background-size: 100% auto !important;
	}

	.testExamination_progress1_areafd1_1_c0_c0_c1 {
		background: rgba(21, 147, 255, 1);
		background-size: 100% !important;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
	}

	.testExamination_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		height: 88rpx;
	}

	.testExamination_fd0_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #111;
	}

	.testExamination_fd0_0_c1 {
		font-size: 32rpx;
		font-weight: bold;
		color: #111111;
	}

	.testExamination_fd0_0_c2 {
		width: 36rpx;
		height: 36rpx;
	}

	.testExamination_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		background-size: 100% !important;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.page {
		min-height: calc(100vh - var(--window-bottom));
		background: #f6f7fb;
		background-size: 100% auto !important;
	}
</style>